package code.main.controller.table
{
	import code.main.view.table.TimerCircle;
	
	import flash.display.DisplayObject;
	import flash.display.MovieClip;

	/**
	 *时间控制器 
	 * @author YY
	 * 
	 */
	public class TimeCtrl
	{
		private var _timeCircle:TimerCircle;
		private var _dobj:DisplayObject;
		//时间的位置
		private var _timePos:Array = [
			[605,160],
			[697,321],
			[605,482],
			[386,548],
			[159,482],
			[64,321],
			[159,160],
		];
		public function TimeCtrl(rec:MovieClip)
		{
			_dobj = rec;
			_timeCircle = new TimerCircle(rec.chipInTimer,rec.timeTip);
		}
		
		/**
		 *开始倒计时 
		 * @param seatId 座位id
		 * @param t	倒计时时间
		 * 
		 */
		public function startTime(seatId:int, t:int, cb:Function):void {
			var pos:Array = _timePos[--seatId];
			_dobj.x = pos[0];
			_dobj.y = pos[1];
			_timeCircle.start(t, cb); 
		}
		
		/**
		 *停掉倒计时 
		 * 
		 */
		public function stopTime():void {
			_timeCircle.stop();
		}
	}
}